Skip to content

test: compare resolved paths in the symlinked-root scan test (Windows) - #724

Merged
ffumero2003 merged 1 commit into
masterfrom
fix-python-windows-symlink-path-test
Nov 22, 2026
Merged

ffumero2003 merged 1 commit into
masterfrom
fix-python-windows-symlink-path-test

Conversation

@ffumero2003

Copy link
Copy Markdown
Contributor

Context

After the C54 fix (#717) merged, Python master fails the Windows test matrix on test/unit/scan/test_folder.py::test_make_full_path_accepts_internal_link_and_symlinked_root:

assert LocalFolder(root_link).make_full_path('link/new-file.txt') == str(root_link / 'link' / 'new-file.txt')
AssertionError: '\\?\\C:\\...\\new-file.txt' == 'C:\\Users\\...\\new-file.txt'

Root cause

On Windows, resolving the symlinked root yields an extended-length (\\?\\) path, so the raw string differs from the unprefixed expected path. The containment behaviour under test (a symlinked root plus an internal link is accepted and points at the right file) is correct — only the exact-string comparison is not platform-portable.

Changes

  • Compare os.path.realpath() of the result and the expected path instead of raw strings (Linux/macOS unaffected). Add the missing os import.

Verification

  • Resolving both sides normalizes the \\?\\ prefix; the behavioural assertion is preserved.

Refs #711

The C54 containment test asserted an exact path string, but on Windows
symlink resolution can return an extended-length (\\?\\) path, so the
raw-string comparison failed there while the containment behaviour is
correct. Compare os.path.realpath of both sides instead.

Refs #711
@ffumero2003 ffumero2003 self-assigned this Nov 22, 2026
@coderabbitai

coderabbitai Bot commented Nov 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

This organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing.

Next included review available in 16 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fbb456f3-1a3d-48d1-a934-f7e04cf181f4
Commits

Reviewing files that changed from the base of the PR and between 23f39d6 and 11535b9.

Files selected for processing: 2

  • changelog.d/+windows-symlink-path-test.infrastructure.md
  • test/unit/scan/test_folder.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@ffumero2003
ffumero2003 merged commit 901933f into master Nov 22, 2026
23 of 28 checks passed
@ffumero2003
ffumero2003 deleted the fix-python-windows-symlink-path-test branch November 22, 2026 00:12
ffumero2003 added a commit that referenced this pull request Nov 22, 2026
The previous realpath comparison (#724) did not normalize the Windows
extended-length (\\?\\) prefix: realpath keeps it on the returned path
but not on the expected one. Compare os.path.samefile of the existing
parent directory plus the file name, which is immune to the prefix.

Refs #711
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant